﻿package org.oschina.util;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

public class PrintUtil {

	/**
	 * 输出字符串
	 * @param msg 信息
	 * @param contentType 类型
 	 * @param response
	 */
	public static void print(String msg,String contentType,HttpServletResponse response)
	{
		try
		{
			response.setCharacterEncoding("UTF-8");
			response.setContentType(contentType);
			response.setHeader("Pragma","No-cache");  
			response.setHeader("Cache-Control","no-cache");  
			response.setDateHeader("Expires", 0);  
			PrintWriter out=response.getWriter();
			out.println(msg);
			out.flush();
			out.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}